package com.example.saiweisi.service.impl.userService;

import com.example.saiweisi.mapper.userMapper.ValidationMapper;
import com.example.saiweisi.model.Validation;
import com.example.saiweisi.service.interf.IValidation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class ValidationService implements IValidation {
    @Autowired
     ValidationMapper validationMapper;
    public void saveCode(String email, String code, Date offsetMinute) {
        Validation validation=new Validation();
        validation.setCode(code);
        validation.setEmail(email);
        validation.setTime(offsetMinute);
        validationMapper.saveValidation(validation);
    }

    public  int getByEmail(String email) {
        return validationMapper.getByEmail(email);
    }

    @Override
    public Date getTimeByEmail(String email) {
        return validationMapper.getTimeByEmail(email);
    }
}
